<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/index_work.css">
</head>
<body>
<table>
    <tr>
        <th colspan="7">用户列表</th>
    </tr>
    <tr>
        <th>用户id</th>
        <th>用户名</th>
        <th>密码</th>
        <th>年龄</th>
        <th>性别</th>
        <th>邮箱</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${requestScope.pageInfo.list}" var="user">
        <tr>
            <td>${pageScope.user.id}</td>
            <td>${pageScope.user.username}</td>
            <td>${pageScope.user.password}</td>
            <td>${pageScope.user.age}</td>
            <td>${pageScope.user.sex}</td>
            <td>${pageScope.user.email}</td>
            <td>
                <a href="${pageContext.request.contextPath}/update/${pageScope.user.id}/${requestScope.pageInfo.pageNum}">修改</a>
                <a href="${pageContext.request.contextPath}/delete/${pageScope.user.id}/${requestScope.pageInfo.pageNum}">删除</a>
            </td>
        </tr>
    </c:forEach>
    <%--分页导航条--%>
    <tr>
        <td colspan="7">
            <c:if test="${!requestScope.pageInfo.isFirstPage}">
                <a href="${pageContext.request.contextPath}/test/1">首页</a>
                <a href="${pageContext.request.contextPath}/test/${requestScope.pageInfo.prePage}">上一页</a>
            </c:if>
            <c:forEach items="${requestScope.pageInfo.navigatepageNums}" var="page">
                <c:if test="${pageScope.page==requestScope.pageInfo.pageNum}">
                    <a href="${pageContext.request.contextPath}/test/${requestScope.pageInfo.pageNum}">[${requestScope.pageInfo.pageNum}]</a>
                </c:if>
                <c:if test="${pageScope.page!=requestScope.pageInfo.pageNum}">
                    <a href="${pageContext.request.contextPath}/test/${pageScope.page}">${pageScope.page}</a>
                </c:if>
            </c:forEach>
            <c:if test="${requestScope.pageInfo.hasNextPage}">
                <a href="${pageContext.request.contextPath}/test/${requestScope.pageInfo.nextPage}">下一页</a>
                <a href="${pageContext.request.contextPath}/test/${requestScope.pageInfo.pages}">末页</a>
            </c:if>
        </td>
    </tr>
</table>
</body>
</html>
